﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *  
 **/

using System.Collections.ObjectModel;
using Peter.Common.MainMenu;

namespace Peter.Common
{
   /// <summary>
   /// A main menu header item.
   /// </summary>
   public class PeterMainMenuHeader : ViewModelBase, IMainMenuHeader
   {
      private bool m_IsSelected;
      private bool m_IsEnabled = true;
      private bool m_IsVisible = true;
      private string m_Title;
      private string m_ToolTip;
      private MainMenuIcon m_Icon = MainMenuIcon.None;

      /// <summary>
      /// Initializes a new menu header item.
      /// </summary>
      /// <param name="title">The title of the menu header.</param>
      public PeterMainMenuHeader (string title)
      {
         this.Title = title.ToUpper ();
         this.Children = new ObservableCollection<IMainMenuItem> ();
         this.MenuItems = new ObservableCollection<IMainMenuItem> ();
      }

      /// <summary>
      /// Gets the priority of the menu item.
      /// </summary>
      public int Priority { get; set; }

      /// <summary>
      /// Gets the title to display for the menu item.
      /// </summary>
      public string Title
      {
         get { return this.m_Title; }
         set
         {
            if (this.m_Title != value)
            {
               this.m_Title = value;
               this.RaisePropertyChanged ("Title");
            }
         }
      }

      /// <summary>
      /// Gets the url of the icon to display for the menu item.
      /// </summary>
      public MainMenuIcon Icon
      {
         get { return this.m_Icon; }
         set
         {
            if (this.m_Icon != value)
            {
               this.m_Icon = value;
               this.RaisePropertyChanged ("Icon");
            }
         }
      }

      /// <summary>
      /// Gets or Sets if the item is enabled.
      /// </summary>
      public bool IsEnabled
      {
         get { return this.m_IsEnabled; }
         set
         {
            if (this.m_IsEnabled != value)
            {
               this.m_IsEnabled = value;
               this.RaisePropertyChanged ("IsEnabled");
            }
         }
      }

      /// <summary>
      /// Gets the tool tip to display for the menu item.
      /// </summary>
      public string ToolTip
      {
         get { return this.m_ToolTip; }
         set
         {
            if (this.m_ToolTip != value)
            {
               this.m_ToolTip = value;
               this.RaisePropertyChanged ("ToolTip");
            }
         }
      }

      /// <summary>
      /// Gets or Sets if the header is selected.
      /// </summary>
      public bool IsSelected
      {
         get { return this.m_IsSelected; }
         set
         {
            if (this.m_IsSelected != value)
            {
               this.m_IsSelected = value;
               this.RaisePropertyChanged ("IsSelected");
            }
         }
      }

      /// <summary>
      /// Gets or Sets if the menu item is visible.
      /// </summary>
      public bool IsVisible
      {
         get { return this.m_IsVisible; }
         set
         {
            m_IsVisible = value;
            this.RaisePropertyChanged ("IsVisible");
         }
      }

      /// <summary>
      /// Gets the list of children menu items.
      /// </summary>
      public ObservableCollection<IMainMenuItem> Children { get; private set; }

      /// <summary>
      /// Gets the list of children menu items for a drop down menu on the header.
      /// </summary>
      public ObservableCollection<IMainMenuItem> MenuItems { get; private set; }
   }
}
